<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?><?php bloginfo('name'); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="shortcut icon" href="<?php get_option_tree('favicon', '', true); ?>" />
<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/print.css" type="text/css" media="print" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if IE 7 ]>
<link href="<?php bloginfo('template_url'); ?>/ie7.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 8 ]>
<link href="<?php bloginfo('template_url'); ?>/ie8.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if lte IE 6]>
<div id="ie-message">Your browser is obsolete and does not support this webpage. Please use newer version of your browser or visit <a href="http://www.ie6countdown.com/" target="_new">Internet Explorer 6 countdown page</a>  for more information. </div>
<![endif]-->
<?php 
if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );
wp_head(); 
?>

<?php include 'var.php'; ?>  
<?php get_option_tree('analytics_code', '', true); ?>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1&appId=340759469355886";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</head>
<body <?php body_class(); ?>>

<!-- *******************************Wrapper********************************** -->
<div id="aligner">
<div id="wrapper">

<!-- *******************************Logo & Menu****************************** -->
<div id="header">
<div id="logo">
<?php
if ( is_category()){
	$post_term = wp_get_post_terms( $post->ID, 'category' );
	$category_slug = $post_term[0]->slug;
	query_posts(array('post_type' => 'cat_head', 'category_name' => $category_slug,));  
	if ( ! have_posts() ) { ?>
		<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
		<?php }
	else{	
		while ( have_posts() ) : the_post(); 
		if ( get_post_meta($post->ID, 'cat_logo', true)) { ?>
			<a href="<?php bloginfo('url'); ?>"><img src="<?php echo get_post_meta($post->ID, 'cat_logo', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
			<?php } 
		else{ ?>
			<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
	<?php } endwhile; }
	} 
else { 
	if ( is_single() && !is_post_type('portfolio')){
		if ( get_post_meta($post->ID, 'page_color_choice', true) || get_post_meta($post->ID, 'page_image_choice', true)) {?>
			<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
		<?php } else {
			$post_term = wp_get_post_terms( $post->ID, 'category' );
			$category_slug = $post_term[0]->slug;
			query_posts(array('post_type' => 'cat_head', 'category_name' => $category_slug,));  
			if ( ! have_posts() ) { ?>
				<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
				<?php }
			else{	
				while ( have_posts() ) : the_post(); 
				if ( get_post_meta($post->ID, 'cat_logo', true)) { ?>
					<a href="<?php bloginfo('url'); ?>"><img src="<?php echo get_post_meta($post->ID, 'cat_logo', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
					<?php } 
				else{ ?>
					<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
			<?php } endwhile; }
			wp_reset_query();
		}	
	} 
	else { ?>	
		<a href="<?php bloginfo('url'); ?>"><img src="<?php get_option_tree('logo_uploud', '', true); ?>" alt="<?php bloginfo('name'); ?>" /></a>
<?php }} ?>
</div><!--#logo-->
<p id="slogan"><a href="http://www.vietfuntravel.com.vn" class="slogan-h1">Du Lịch Việt Nam &amp; <span class="font-bold">Tour trọn gói</span> &amp;  <span style="font-bold">Tour hằng ngày</span> &amp; Tour Bắc - Trung - Nam</a> </p>
<div class="widget-area" id="top_sidebar">
<ul class="xoxo">
<li class="widget-container Social_Widget" id="social-widget-9"><div class="socialmedia-buttons smw_left"><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Facebook" alt="Follow Us on Facebook" src="<?php bloginfo('template_url'); ?>/images/facebook500.png"></a><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Dribbble" alt="Follow Us on Dribbble" src="<?php bloginfo('template_url'); ?>/images/dribbble.png"></a><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Twitter" alt="Follow Us on Twitter" src="<?php bloginfo('template_url'); ?>/images/twitter500.png"></a><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Picasa" alt="Follow Us on Picasa" src="<?php bloginfo('template_url'); ?>/images/picasa.png"></a><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Stumble" alt="Follow Us on Stumble" src="<?php bloginfo('template_url'); ?>/images/stumbleupon.png"></a><a target="_blank" rel="nofollow" href="#"><img width="32" height="32" class="fade" style="opacity: 0.9; -moz-opacity: 0.9;" title="Follow Us on Digg" alt="Follow Us on Digg" src="<?php bloginfo('template_url'); ?>/images/digg.png"></a></div></li></ul>
</div>
<?php get_sidebar('top') ?>
</div><!--#header-->


<div id="menu_background">
<div id="main_menu" class="slidemenus">
<?php wp_nav_menu( array('theme_location' => 'primary', 'container' => false, 'fallback_cb' => false)); ?>  
</div><!--#main_menu-->
</div><!--#menu_background-->

<!-- *******************************Subhead********************************** -->
<?php if ( is_home() ) {} else { ?> 
		<?php if ( is_search() ) { ?> 
		<h1 class="entry-title-page"><?php $search_title = get_option_tree('search_results_for'); 
			if ($search_title){ echo $search_title . ' <span>' . get_search_query() . '</span>'; } 
			else { printf( __( 'Search Results for: %s', 'theblog' ), '<span>' . get_search_query() . '</span>' );} ?>
		</h1>
		<?php } elseif ( is_404() ) { ?> 
		<h1 class="entry-title-page" style="text-align:center"> <?php
			$title_404 = get_option_tree('title_404', '', true); 
			if ($title_404){ $title_404; }
			else{ _e('Page Not Found', 'theblog'); }?>
		</h1>
		<?php } elseif (is_category() || is_tag() ){ 
		//echo '<h1 class="entry-title-page">', single_cat_title() .'</h1>';
		} 
		elseif (is_archive() ){ ?>
			<?php if ( is_day() ) : ?>
			<h1 class="entry-title-page"> <?php printf( __( 'Daily Archives: <span>%s</span>', 'theblog' ), get_the_date() ); ?></h1>
			<?php elseif ( is_month() ) : ?>
			<h1 class="entry-title-page"> <?php printf( __( 'Monthly Archives: <span>%s</span>', 'theblog' ), get_the_date( 'F Y' ) ); ?></h1>
			<?php elseif ( is_year() ) : ?>
			<h1 class="entry-title-page"> <?php printf( __( 'Yearly Archives: <span>%s</span>', 'theblog' ), get_the_date( 'Y' ) ); ?></h1>
			<?php elseif ( is_author() ) : ?>
			<h1 class="category-title"> <?php wp_title(''); ?>  </h1>
			<?php else : ?>
			<h1 class="entry-title-page"> <?php _e( 'Archives', 'theblog' ) ?></h1>
			<?php endif; ?>
		<?php } else { echo '<h1 class="entry-title-page">', the_title(''). '</h1>'; } ?>
<?php } ?>